package exception;

public class TryCatchDemoj {
    public static void main(String[] args) {
        System.out.println("程序开始执行！");
        try{
            String str = null;
            String str2 = "abc";
            System.out.println(str.length());
            System.out.println(str2.charAt(6));
        }catch (NullPointerException e){
            System.out.println("出现空指针异常！");
        }catch (StringIndexOutOfBoundsException e){
            System.out.println("出现了字符串索引越界异常");
        }
        System.out.println("程序继续执行！");
    }
}
